while True:
    x=input('鸡兔共几只')
    y=input('鸡兔共几条腿')
    if x<=0 or y<=0 or y%2!=0:
        print('出现错误，请重新输入')
    else:
        for i in range(x+1):
            if -2*i+4*x==y:
                print('鸡有%只，兔有%只'%(i,x-i))
                break
        break
    
